package com.fy.fyspace.model.enums;

/**
 * 用户行为类型枚举
 * 设计模式：枚举模式，用于定义常量值
 */
public enum BehaviorTypeEnum {
    
    /**
     * 下载行为
     */
    DOWNLOAD("DOWNLOAD", "下载"),
    
    /**
     * 点赞行为
     */
    LIKE("LIKE", "点赞"),
    
    /**
     * 收藏行为
     */
    FAVORITE("FAVORITE", "收藏");
    
    private final String code;
    private final String description;
    
    BehaviorTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static BehaviorTypeEnum getByCode(String code) {
        for (BehaviorTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
} 